<template>
  <div>
    <el-tabs v-model="editableTabsValue" @tab-click="clickTab">
      <el-tab-pane name="AgentList" label="代理商">
        <company-list v-if="type == 'A101101'" v-bind:type="type"></company-list>
      </el-tab-pane>
      <el-tab-pane name="ParentCompanyList" label="总公司">
        <company-list v-if="type == 'A101104'" v-bind:type="type"></company-list>
      </el-tab-pane>
      <el-tab-pane name="BranchCompanyList" label="分公司">
        <company-list v-if="type == 'A101107'" v-bind:type="type"></company-list>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>

import CompanyList from './company-list'
export default {
  name: 'company-index',
  components: {
    CompanyList
  },
  data () {
    return {
      editableTabsValue: 'AgentList',
      editableTabs: [],
      type: 'A101101'
    }
  },
  created: function () {
  },
  methods: {
    clickTab: function (tab) {
      if (tab.name === 'AgentList') {
        this.type = 'A101101'
      } else if (tab.name === 'ParentCompanyList') {
        this.type = 'A101104'
      } else if (tab.name === 'BranchCompanyList') {
        this.type = 'A101107'
      }
    }
  }
}
</script>
